package com.baomidou.ant.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2021-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016110200787333";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDQK4rp1eU+l88e6jcBSBqF6WuvUj0Zc6sg+tSO/ra2n5wieHhnFLHX4PpvPi4ERBdiLBxNMeZ0YT710mmV0s9u0cUkKD98gyRICG48t/aYAkCIwdnj2SLNUwTXuxPTAUso0XbnZo2nFOHiVnWe9Jqymo1KTfyxOQlUDkDEjPy6lSWV+vKNHByki+3P0tFJ93fIn56y+9n5nNx0Lff46oCJGJYVB1aw2IsJaYw0O3gwuiEzhlN5gOqEsZEPwz0NlxOfxy8glYd0hi4K1JffqWoMFIKx9kCIXx4CCC4er21UD81Xdl8K5CS09tKPQyRpwuyf6K/J94ykKlIwZITsyoDZAgMBAAECggEBAIKvg0LvlD5qYY3/7c4xLO16r67eCxuKYRmQPpcS0zPtGcEOLlBQTqG/TJk/yPXGpYNtO8s+k3XmgvciRETZln301TWwysJpNgK+wC4AM6AUcd0pDZgb/dw2zSh9+qESA9Q5Q9Nbr3wAARrtumOzHdcYbbEDKqs7ql6JoCGEfTjIPXCiZx+RctCyS+a49V+y07dwJmd53ufdUq8FY2vfgJ2KK8pWC6RBBWUaR6MkDKmnIfRUGtt94LXE5+d6o0Zdn5uTpnG4vSrMBCho1WxuJp/2LIBnyk/SJpFK3S897v6uenfQpDiFA0NjoPVKjDs/mHjumywS3DPonK8Xf21Ku60CgYEA6m9jFVdefuDqTM2f1CIxUGChP89buU3nE0SXyEax2OjcZhNeLza4gOteCPkXMYFWsIVZMWX2r4bjvqnRpfQ+Tkk7Zqexk5xpf+rySPN3AYgCX0JXpffdrZXopaODHCvsll2UyCDjB8ECoKD1krg2Gjn2VOxf+FH8/ICvjTVEin8CgYEA41Gm3gmj8Oqxkp3UaSzGgyHbmhuxKWCTWuOWmB8qkicgpWEBKtj9rS6Kw7Pt060BsRu/tu0jYE7jS/V+I4pPuuu9h4qPcxKJkA/8gTo9B3rgLXANpAS2/ChkT3Q6eJbaOjdOXA0SO1ItZljhQyIhIs+H3hgDHBdCnf8Tf5FH2KcCgYEA3ZYFCHH5fmGm9ItS69aZ2AhNwZuEbiUlKcAm2wV/KrAHSnA6ENRfFnPiAQc4FfHTd6vC/38J6STNdTTcVUkD70km3UPaA9TOnzr6YVvGe2sMGvABGn2rSVytdoqT7XfS+tlfPL5g+L5FdoBNPa3ibW2l2OVHXNZaEmysAgN8Uo8CgYEAnIsCay4gZCx7lQhz2uom2u9aF8qyOlhzocfRUXlFC9k+NiWTdDpyl+zRSuyB/5/I5nrBj+vGzPAGv6yT7U22knb90nWtTAWcDkW0EhpVJO2NrDzaZ/WHPidizQSxr5HTPvwPTn0B7TAua6kRl/XM8/gPDPdkTNgH3F5owxT9cUkCgYBWSX2xZG2MCCOu6EDJts6+D+2bEgT966hXtbFRPc+UWIjTNbO5Bf1dOy/tMvpHQyhKyMk/gkKoXTljyLSvLiOryk2EwEIdlUorFrbC65Qii45artn3BCCm6JgLe01LSU+U12eErhw0TuZwvNNJ/Q7VpSchH2dQKigikl1H+1r9UA==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhz2kAX63hM4UVD8Z1THKA8TTy9vjGHXnJ/7ZKB6WunacQjs4HoXoOw+hC3WEvBwuMIBZ7X3u9H0FmqePt6u+/9yY2R1TbtFpr93bmTVf8b2r3p3ejsaJZR2ESXJ/nadj0swu/QXryol0+zU0C9FipM8ZqZVz1nmg/cZjy6U1ceS1Ho1n+fNrFlxlj6oFj+iJGGLzdTu7Phs09YGWY7S27q4ohgy+WJ71J/csPrse5hNGGvw5IGEGKK53mAQW+0o7uT61gNiEI+gD5hGTLj1llWggXf71gwrfGM95Ls5ae4pWPM+p5DZBw8oNoMK/O5qwi13L5eDBQTvvpC4BC9cJzQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    //120.77.2.117为阿里云服务器的公网ip
    //public static String notify_url = "http://120.77.2.117:8848/payment/notifyUrl";
    public static String notify_url = "http://localhost:8848/payment/notifyUrl";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    //public static String return_url = "http://120.77.2.117:8848/payment/returnUrl";
    public static String return_url = "http://localhost:8848/payment/returnUrl";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}